Imports System.Collections
Imports System.Windows.Forms

Namespace xpComponent.Form
    Public Class LockColumnHeader
        Inherits System.Windows.Forms.NativeWindow

        Public Declare Function GetWindow Lib "user32" Alias "GetWindow" (ByVal hwnd As IntPtr, ByVal wCmd As Integer) As IntPtr
        Public Const GW_CHILD As Integer = 5
        Private SysHdr32Handle As IntPtr

        Private ptrHWnd As IntPtr

        Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
            Select Case m.Msg
                Case Is = xpComponent.Win32.WindowMessages.wmSetCursor '&H20  ' WM_SETCURSOR
                    m.Msg = 0
                Case Is = xpComponent.Win32.WindowMessages.wmLButtonDown '&H201  ' WM_LBUTTONDOWN
                    m.Msg = 0
                Case Is = xpComponent.Win32.WindowMessages.wmLButtonUp
                    m.Msg = 0
            End Select

            MyBase.WndProc(m)
        End Sub

        Protected Overrides Sub Finalize()
            Me.ReleaseHandle()
            MyBase.Finalize()
        End Sub

        Public Sub New(ByVal ControlHandle As IntPtr)
            ptrHWnd = ControlHandle
            Me.AssignHandle(ptrHWnd)
        End Sub
    End Class
End Namespace